import { loginReq } from "../../servies"

export const initstate = {
    userInfo: {},
    loginData: {}
}

export const actions = {
    getUserInfo() {},
    login(payload) {
        // 数据请求 return 的是回调函数
        console.log("1:", payload)
        return async dispatch => {
            dispatch({
                type: "LOGIN",
                // payload: await loginReq(payload)
                payload: await '888888'
            })
        }
    }
}

export function reducers (state = initstate, {type, payload}) {
    const newState = { ...state }
    switch(type) {
        case "LOGIN":
            // 操作
            console.log("payload", payload)
            break;
        default:
            return ""
            break;
    }
    return newState
}